package com.chinacoal.microservice;

import com.chinacoal.microservice.fallback.HouseTypeManagementClientFallback;
import com.chinacoal.microservice.pojo.CcmsSmartleasingHouseType;
import com.chinacoal.microservice.util.QueryCriteria;
import com.chinacoal.microservice.util.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignAutoConfiguration;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author zhuliang
 * @version V1.0
 * @Description: 房源管理-户型管理-对外开发接口类
 * @date 2020-11-11 11：10
 */
@Api(tags = {"房源管理-户型管理-对外开发接口类"})
@FeignClient(name = "${spring.application.name}",fallback = HouseTypeManagementClientFallback.class,configuration = FeignAutoConfiguration.class)
public interface HouseTypeManagementClient {

    /**
     * @Description: 查询所有的户型信息（带分页）
     * @author zhuliang
     * @date 2020/11/11 11:21
     */
    @ApiOperation(value = "查询所有的户型信息（带分页）")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "body", name = "queryCriteria", value = "查询条件实体类", required = true, dataType = "QueryCriteria"),
            @ApiImplicitParam(paramType = "header", name = "token", value = "令牌", required = true, dataType = "String")
    })
    @PostMapping("smartleasing/houseTypeInformation/getAllTypes")
    public Result<List<CcmsSmartleasingHouseType>> getAllTypes(@RequestBody QueryCriteria queryCriteria,
                                                               @RequestHeader("token") String token);

    /**
     * @Description: 根据户型id查询对应的户型信息
     * @author zhuliang
     * @date 2020/11/11 11:56
     */
    @ApiOperation(value = "根据户型id查询对应的户型信息")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "path", name = "pkHouseTypeId", value = "户型ID", required = true, dataType = "String"),
            @ApiImplicitParam(paramType = "header", name = "token", value = "令牌", required = true, dataType = "String")
    })
    @GetMapping("smartleasing/houseTypeInformation/getTypeById/{pkHouseTypeId}")
    public Result<CcmsSmartleasingHouseType> getTypeById(@PathVariable(value = "pkHouseTypeId") String pkHouseTypeId,
                                                         @RequestHeader("token") String token);

    /**
     * @Description: 添加户型信息
     * @author zhuliang
     * @date 2020/11/11 13:44
     */
    @ApiOperation(value = "添加户型信息")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "body", name = "houseType", value = "户型信息的实体", required = true, dataType = "CcmsSmartleasingHouseType"),
            @ApiImplicitParam(paramType = "header", name = "token", value = "令牌", required = true, dataType = "String")
    })
    @PostMapping("smartleasing/houseTypeInformation/addHouseType")
    public Result addHouseType(@RequestBody CcmsSmartleasingHouseType houseType,
                               @RequestHeader("token") String token);

    /**
     * @Description: 修改户型信息
     * @author zhuliang
     * @date 2020/11/11 13:56
     */
    @ApiOperation(value = "修改户型信息")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "body", name = "houseType", value = "户型信息的实体", required = true, dataType = "CcmsSmartleasingHouseType"),
            @ApiImplicitParam(paramType = "header", name = "token", value = "令牌", required = true, dataType = "String")
    })
    @PutMapping("smartleasing/houseTypeInformation/updateHouseType")
    public Result updateHouseType(@RequestBody CcmsSmartleasingHouseType houseType,
                                  @RequestHeader("token") String token);

    /**
     * @Description: 根据户型id批量删除户型信息
     * @author zhuliang
     * @date 2020/11/11 14:01
     */
    @ApiOperation(value = "根据户型id批量删除户型信息")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "path", name = "deleteId", value = "要删除的id字符串", required = true, dataType = "String"),
            @ApiImplicitParam(paramType = "header", name = "token", value = "令牌", required = true, dataType = "String")
    })
    @DeleteMapping("smartleasing/houseTypeInformation/deleteHouseType/{deleteId}")
    public Result deleteHouseType(@PathVariable(value = "deleteId",required = false) String deleteId,
                                  @RequestHeader("token") String token);

    /**
     * @Description: 条件查询（带分页）
     * @author zhuliang
     * @date 2020/11/11 14:36
     */
    @ApiOperation(value = "条件查询（带分页）")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "body", name = "queryCriteria", value = "查询条件的实体", required = true, dataType = "QueryCriteria"),
            @ApiImplicitParam(paramType = "header", name = "token", value = "令牌", required = true, dataType = "String")
    })
    @PostMapping("smartleasing/houseTypeInformation/getConditionQuery")
    public Result<List<CcmsSmartleasingHouseType>> getConditionQuery(@RequestBody QueryCriteria queryCriteria,
                                                                     @RequestHeader("token") String token);

    /**
     * @Description: 根据楼宇id查询户型信息
     * @author zhuliang
     * @date 2020/11/12 17:26
     */
    @ApiOperation(value = "根据楼宇id查询户型信息")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "path", name = "fkBuildingId", value = "楼宇id", required = true, dataType = "String"),
            @ApiImplicitParam(paramType = "header", name = "token", value = "令牌", required = true, dataType = "String")
    })
    @GetMapping("smartleasing/houseTypeInformation/getHouseTypeByBuildingId/{fkBuildingId}")
    public Result<List<CcmsSmartleasingHouseType>> getHouseTypeByBuildingId(@PathVariable(value = "fkBuildingId") String fkBuildingId,
                                                                            @RequestHeader("token") String token);
}
